<!DOCTYPE html>
<html>
    <head>
	<title>Long polling example</title>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
	<script type="text/javascript" src="jquery.longpolling.js"></script>
	<script type="text/javascript">
	    (function($){
		$(function(){
		    $.longpolling({
			url: '/longpolling.php',
			success: function(data){
			    if(data.results !== undefined){
				var lis = '';
				$.each(data.results, function(){
				    lis += '<li>' + this + '</li>';
				});
				$('#Results').html(lis);
			    }
			},
			dataType: 'json',
			type: 'GET'
		    });
		});
	    })(jQuery);
	</script>
    </head>
    <body>
	<h1>Long polling - wait for results</h1>
	<ul id="Results">
	</ul>
    </body>
</html>